#ifndef _MAPA_H
#define	_MAPA_H

#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QMouseEvent>
#include <QPainter>
#include <QPixmap>

const int posIndicadores[42][2]={
    {59,50},
    {101,79},
    {94,177},
    {142,129},
    {295,27},
    {118,51},
    {158,85},
    {205,85},
    {89,117},
    {195,338},
    {222,273},
    {165,277},
    {177,221},
    {338,81},
    {330,50},
    {398,86},
    {403,51},
    {414,109},
    {455,75},
    {352,119},
    {528,107},
    {607,138},
    {564,163},
    {617,79},
    {716,129},
    {704,52},
    {474,146},
    {627,108},
    {635,188},
    {564,49},
    {521,61},
    {629,51},
    {422,239},
    {455,204},
    {423,158},
    {497,304},
    {367,184},
    {427,295},
    {744,311},
    {671,237},
    {746,253},
    {683,317},
};

class Indicador : public QObject, public QGraphicsItem{
    Q_OBJECT
private:
    int x, y, radio;
    QString texto;
    QColor color;
public:
    Indicador(int x0, int y0);
    void setText(int tropas);
    void setColor(QColor c);
    QRectF boundingRect() const;
    QPainterPath shape() const;  
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget);
};

class GView : public QGraphicsView{
    Q_OBJECT
private:
    QImage Mascara;
    QGraphicsScene *Escena;
    Indicador *indicadores[42];
    void crearIndicador(int index);

public:
    GView(QWidget *parent);
    void mouseReleaseEvent(QMouseEvent *event);
    void asignarIndicador(int index, QColor color, int tropas=1);
    void actualizarIndicador(int index, int tropas);

signals:
    void mouseReleased(int point);
};

#endif	/* _MAPA_H */


